package top.tupobi.zing.base;


import top.tupobi.zing.InfoRecord;

public abstract class BasePresenter<V extends IBaseView> implements IBasePresenter<V> {

    public static final int ACTIVITY_STATUS_CREATED = 43000;
    public static final int ACTIVITY_STATUS_FRONT = 43001;
    public static final int ACTIVITY_STATUS_HIDE = 43002;
    public static final int ACTIVITY_STATUS_DESTROYED = 43003;


    protected V mView;

    protected int mActivityStatus;

    @Override
    public void attach(V view) {
        InfoRecord.setAtyChatStatus(ACTIVITY_STATUS_CREATED);
        mActivityStatus = ACTIVITY_STATUS_CREATED;
        this.mView = view;
    }

    @Override
    public void detach() {
        InfoRecord.setAtyChatStatus(ACTIVITY_STATUS_DESTROYED);
        mActivityStatus = ACTIVITY_STATUS_DESTROYED;
        this.mView = null;
    }

    protected final void toast(String msg) {
        mView.toast(msg);
    }

    protected final void finishCurrentAty() {
        mView.finishCurrentAty();
    }
}
